package cn.edu.sgu.www.pms.util;

import cn.edu.sgu.www.pms.config.property.FeignHeaderProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 请求头匹配器
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Component
public class HeaderMatcher {

    private static String headerName;
    private static String headerValue;

    @Autowired
    public HeaderMatcher(FeignHeaderProperties feignHeaderProperties) {
        headerName = feignHeaderProperties.getName();
        headerValue = feignHeaderProperties.getValue();
    }

    public static boolean match(String header) {
        return PasswordEncoder.matches(header, headerValue);
    }

    public static String getHeaderName() {
        return headerName;
    }

}